﻿using System;
using System.Collections.Generic;
using UnityEngine.Pool;

namespace KuiHuaBaoDian.Services.Asset {

    internal sealed partial class KHBD_AssetService {

        private class CacheGroup : IDisposable {

            public enum State {
                Loading,
                Completed,
                Failed,
                Cancelled,
            }

            public CacheGroup(bool isGameObject) {
                IsGameObject = isGameObject;
                KeyStateDictionary = DictionaryPool<string, State>.Get();
            }

            public bool IsGameObject { get; }

            public Dictionary<string, State> KeyStateDictionary { get; private set; }

            void IDisposable.Dispose() {
                DictionaryPool<string, State>.Release(KeyStateDictionary);
                KeyStateDictionary = null;
            }
        }
    }
}
